Home:ALL Converter>Prevent closure to from renaming object keys

Prevent closure to from renaming object keys

Ask Time:2015-03-31T03:05:31         Author:Yousuf Jawwad

Json Formatter

I have a document['key'] that i am defining in elsewhere in my code. Basically an API key that is being set by client in html <script></script> tag like this.

<script type="text/javascript">
(function(){
  document.clientKey = 'a uuid unique to client';
})();
</script>

i called this key in my javascript file via document['clientKey'] and it was working fine, until i passed it to closure, which renames it to document.I. Can I force closure to keep the string 'clientKey'

Author:Yousuf Jawwad,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/29354192/prevent-closure-to-from-renaming-object-keys
yy